package com.tool;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

public class scanTool {

    private  List<String> classNames=new LinkedList<>();
    private void doScanner(String packageName) {
        //packageName = packageName.replaceAll("\\.", "/");
        //把所有的.替换成/
        //URL url = this.getClass().getClassLoader().getResource("/" + packageName.replaceAll("\\.", "/"));
        String path = this.getClass().getClassLoader().getResource("").getPath();
        path = path + packageName.replaceAll("\\.", "/");

        File dir = new File(path);
        for (File file : dir.listFiles()) {
            if (file.isDirectory()) {
                //递归读取包
                doScanner(packageName + "." + file.getName());
            } else {
                String className = packageName + "." + file.getName().replace(".class", "");
                classNames.add(className);
            }
        }
    }
}
